package org.spark.example

import java.io.File

/**
  * @Author: chengjj
  * @Date: 2020-08-19
  */
class Utils {
    def deleteDir(dir: File): Unit = {
        if( dir == null){
            return;
        }
        val files = dir.listFiles()
        if(files == null){
            return;
        }
        files.foreach(f => {
            if (f.isDirectory) {
                deleteDir(f)
            } else {
                f.delete()
                println("delete file " + f.getAbsolutePath)
            }
        })
        dir.delete()
        println("delete dir " + dir.getAbsolutePath)
    }
}
